Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support auto pagination #10

Closed
wants to merge 1 commit into from
Closed

Conversation

realaboo
Copy link

This is just a proof of concept. Feel free to reject or modify.

Set autoPaginate={true} on the GiftedListView to enable auto pagination. onEndReachedThreshold could be used to tune the trigger of auto pagination.

@realaboo
Copy link
Author

I found on iOS unexpected onEndReached may be triggered, especially at first onFetch. Works well on Android.

Another approach may be using onChangeVisibleRows. That would require a user provided function like

isLastRow(rowData)

to see if last row becomes visible on screen. Just a thought, I haven't tested it yet.

@liukepeng
Copy link

How to run it for ios ,when I run it in xcode, the xcode tell me "RCtRootView.h" file not found.

@faceyspacey
Copy link

@realaboo what as the issue with onEndReached being triggered accidentally? I'm about to use it. I can fix it if necessary.

@realaboo
Copy link
Author

realaboo commented Mar 2, 2016

@faceyspacey I just found it unstable on iOS but did not dig into it. You can test it yourself with latest react native release.

@faceyspacey
Copy link

automatic infinite scroll as provided here really would make this package one of the best list view packages. it's the one missing feature that everyone has on their checklist when they go looking around for which of these list views to use.

@faceyspacey
Copy link

any word on when this will be merged?

@FaridSafi
Copy link
Owner

Hello, I didn't merge it because @realaboo said it was a just proof of concept and it was unstable on iOS. I don't have time to improve it but if someone can submit a pull request it will be merged.

@faceyspacey
Copy link

i created a PR fixing the issues with multiple fires of onEndReached (and therefore multiple unnecessary fetching) on iOS:

#37

I'd say GiftedListVIew is ready for infinite scrolling!

@faceyspacey
Copy link

another thing: I think the prop should be called infiniteScrolling rather than autoPaginate as that's what people scan the readme looking for to see if it supports it. Most the other similar components have the word "infinite" in it, and is what people search for on js.coach. That was one of the main things that initially made me apprehensive about using GiftedListView. That's why at least having this prop in the readme is important. I also tested a search on js.coach for "infinite" and it also brings up components that have the word in the readme, so we'll be good there. And to be clear, js.coach is full-text search so a search for "infinite" will also bring up "infiniteScrolling." But I'll leave it up to @FaridSafi.

here's a search for a "infin":

https://js.coach/react-native/generator-irrigate?search=infin

As you can see, we aren't listed, but it's enough to bring up any component that has those consecutive characters in the readme. See the component "generator-irrigate" which only has the full word "infinite" in the readme.

@faceyspacey
Copy link

for anyone following this pull request, i did a lot more:

#38

...basically, there were a lot more issues than just the initial load triggering onEndReached. I killed every single one I can find and can easily solve anymore via the things I have setup (panResponder callbacks + datetime flags) to catch "false positive" onEndReach firings. This is on its way to actually being usable, and perhaps more usable than a lot of other React Native infinite scroll components doing this stuff. Basically the onEndReached callback React Native (and perhaps plain iOS) provides is no good, and any package relying simply on that offers an unusable form of infinite scrolling. Not in React Native at least where re-renderings of any sort simply trigger it again (pagination view hiding/showing, manual calls to refresh--when you're near the bottom, any re-rendering is dangerous). So I built a lot to address the various scenarios that arise.

@realaboo
Copy link
Author

realaboo commented Apr 3, 2016

@faceyspacey Thanks!
I'm closing this PR. Discussions will be continued in #38 and #37.

@realaboo realaboo closed this Apr 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants